package Arbore;

public abstract class Nod {
    protected Nod fStang;
    protected Nod fDrept;
    protected double x;

    public Nod getfStang() {
        return fStang;
    }

    public void setfStang(Nod fStang) {
        this.fStang = fStang;
    }

    public Nod getfDrept() {
        return fDrept;
    }

    public void setfDrept(Nod fDrept) {
        this.fDrept = fDrept;
    }

    public double getX() {
        return x;
    }

    public void setX(double x) {
        if(fStang != null && fDrept != null) {
            this.fDrept.x=x;
            this.fStang.x=x;
        }
        else if(fStang == null)
                this.fDrept.x = x;
        else if(fDrept == null)
                this.fStang.x = x;
        this.x=x;
    }

    public abstract double calcul();
    public abstract String derivare();
    public abstract double calculDerivata();
    public abstract String toString();
}
